package com.thinkcube.edutainment.service.viewitem;

import org.androidannotations.annotations.EViewGroup;
import org.androidannotations.annotations.ViewById;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.thinkcube.edutainment.R;
import com.thinkcube.edutainment.domain.data.MessageData;

/**
 * Shanuka @Cyberlmj 3:08:30 PM Email: shanuka.gayashan@cyberlmj.com
 */
@EViewGroup(R.layout.message_title_view)
public class MessageItem extends RelativeLayout {

	@ViewById(R.id.from_name)
	TextView from_name;

	@ViewById(R.id.subject)
	TextView subject;

	@ViewById(R.id.date)
	TextView date;

	@ViewById(R.id.body)
	TextView body;
	
	@ViewById(R.id.reply)
	Button reply;

	@ViewById(R.id.delete)
	Button delete;

	@ViewById(R.id.subject_2)
	TextView subject2;
	
	public Button getReply() {
		return reply;
	}

	public void setReply(Button reply) {
		this.reply = reply;
	}

	public Button getDelete() {
		return delete;
	}

	public void setDelete(Button delete) {
		this.delete = delete;
	}

	public MessageItem(final Context context) {
		super(context);

	}

	public MessageItem(final Context context, final AttributeSet attrs) {
		super(context, attrs);
	}

	public void bind(final MessageData messageData) {

		if (messageData.getSenderName() != null) {
			from_name.setText(messageData.getSenderName());
		}
		if (messageData.getCreatedDate() != null) {
			date.setText(messageData.getCreatedDate());
		}
		if (messageData.getSubject() != null) {
			subject.setText(messageData.getSubject());
			subject2.setText(messageData.getSubject());
		}

		if (messageData.getMessage() != null) {
			body.setText(messageData.getMessage());
		}

	}
}
